<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="theme-color" content="#33474d">
	<title>Linux 命令- netstat | 失落的乐章</title>
	<link rel="stylesheet" href="/css/style.css" />
	
      <link rel="alternate" href="/atom.xml" title="失落的乐章" type="application/atom+xml">
    
</head>

<body>

	<header class="header">
		<nav class="header__nav">
			
				<a href="/archives" class="header__link">Archive</a>
			
				<a href="/tags" class="header__link">Tags</a>
			
				<a href="/atom.xml" class="header__link">RSS</a>
			
		</nav>
		<h1 class="header__title"><a href="/">失落的乐章</a></h1>
		<h2 class="header__subtitle">技术面前，永远都是学生。</h2>
	</header>

	<main>
		<article>
	
		<h1>Linux 命令- netstat</h1>
	
	<div class="article__infos">
		<span class="article__date">2017-10-12</span><br />
		
		
			<span class="article__tags">
			  	<a class="article__tag-link" href="/tags/Linux命令/">Linux命令</a>
			</span>
		
	</div>

	

	
		<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;netstat命令用于显示与IP、TCP、UDP和ICMP协议相关的统计数据，一般用于检验本机各端口的网络连接情况。netstat是在内核中访问网络及相关信息的程序，它能提供TCP连接，TCP和UDP监听，进程内存管理的相关报告。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果你的计算机有时候接收到的数据报导致出错数据或故障，你不必感到奇怪，TCP/IP可以容许这些类型的错误，并能够自动重发数据报。但如果累计的出错情况数目占到所接收的IP数据报相当大的百分比，或者它的数目正迅速增加，那么你就应该使用netstat查一查为什么会出现这些情况了。</p>
<h2 id="1．命令格式"><a href="#1．命令格式" class="headerlink" title="1．命令格式"></a>1．命令格式</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat [-acCeFghilMnNoprstuvVwx] [-A&lt;网络类型&gt;] [--ip]</div></pre></td></tr></table></figure>
<h2 id="2．命令功能"><a href="#2．命令功能" class="headerlink" title="2．命令功能"></a>2．命令功能</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;netstat用于显示与IP、TCP、UDP和ICMP协议相关的统计数据，一般用于检验本机各端口的网络连接情况。</p>
<h2 id="3．命令参数"><a href="#3．命令参数" class="headerlink" title="3．命令参数"></a>3．命令参数</h2><ul>
<li>-a或–all 显示所有连线中的Socket。</li>
<li>-A&lt;网络类型&gt;或–&lt;网络类型&gt; 列出该网络类型连线中的相关地址。</li>
<li>-c或–continuous 持续列出网络状态。</li>
<li>-C或–cache 显示路由器配置的快取信息。</li>
<li>-e或–extend 显示网络其他相关信息。</li>
<li>-F或–fib 显示FIB。</li>
<li>-g或–groups 显示多重广播功能群组组员名单。</li>
<li>-h或–help 在线帮助。</li>
<li>-i或–interfaces 显示网络界面信息表单。</li>
<li>-l或–listening 显示监控中的服务器的Socket。</li>
<li>-M或–masquerade 显示伪装的网络连线。</li>
<li>-n或–numeric 直接使用IP地址，而不通过域名服务器。</li>
<li>-N或–netlink或–symbolic 显示网络硬件外围设备的符号连接名称。</li>
<li>-o或–timers 显示计时器。</li>
<li>-p或–programs 显示正在使用Socket的程序识别码和程序名称。</li>
<li>-r或–route 显示Routing Table。</li>
<li>-s或–statistice 显示网络工作信息统计表。</li>
<li>-t或–tcp 显示TCP传输协议的连线状况。</li>
<li>-u或–udp 显示UDP传输协议的连线状况。</li>
<li>-v或–verbose 显示指令执行过程。</li>
<li>-V或–version 显示版本信息。</li>
<li>-w或–raw 显示RAW传输协议的连线状况。</li>
<li>-x或–unix 此参数的效果和指定”-A unix”参数相同。</li>
<li>–ip或–inet 此参数的效果和指定”-A inet”参数相同。</li>
</ul>
<h2 id="4．使用实例"><a href="#4．使用实例" class="headerlink" title="4．使用实例"></a>4．使用实例</h2><h3 id="实例1：无参数使用"><a href="#实例1：无参数使用" class="headerlink" title="实例1：无参数使用"></a>实例1：无参数使用</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat</span></div><div class="line">Active Internet connections (w/o servers)</div><div class="line">Proto Recv-Q Send-Q Local Address               Foreign Address             State      </div><div class="line">tcp        0    268 192.168.120.204:ssh         10.2.0.68:62420             ESTABLISHED </div><div class="line">udp        0      0 192.168.120.204:4371        10.58.119.119:domain        ESTABLISHED </div><div class="line">Active UNIX domain sockets (w/o servers)</div><div class="line">Proto RefCnt Flags       Type       State         I-Node Path</div><div class="line">unix  2      [ ]         DGRAM                    1491   @/org/kernel/udev/udevd</div><div class="line">unix  4      [ ]         DGRAM                    7337   /dev/<span class="built_in">log</span></div><div class="line">unix  2      [ ]         DGRAM                    708823 </div><div class="line">unix  2      [ ]         DGRAM                    7539   </div><div class="line">unix  3      [ ]         STREAM     CONNECTED     7287   </div><div class="line">unix  3      [ ]         STREAM     CONNECTED     7286   </div><div class="line">[root@localhost ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;从整体上看，netstat的输出结果可以分为两个部分：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;一个是Active Internet connections，称为有源TCP连接，其中”Recv-Q”和”Send-Q”指的是接收队列和发送队列。这些数字一般都应该是0。如果不是则表示软件包正在队列中堆积。这种情况只能在非常少的情况见到。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;另一个是Active UNIX domain sockets，称为有源Unix域套接口(和网络套接字一样，但是只能用于本机通信，性能可以提高一倍)。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Proto显示连接使用的协议,RefCnt表示连接到本套接口上的进程号,Types显示套接口的类型,State显示套接口当前的状态,Path表示连接到套接口的其它进程使用的路径名。</p>
<h4 id="套接口类型："><a href="#套接口类型：" class="headerlink" title="套接口类型："></a>套接口类型：</h4><ul>
<li>-t ：TCP</li>
<li>-u ：UDP</li>
<li>-raw ：RAW类型</li>
<li>–unix ：UNIX域类型</li>
<li>–ax25 ：AX25类型</li>
<li>–ipx ：ipx类型</li>
<li>–netrom ：netrom类型</li>
</ul>
<h4 id="状态说明："><a href="#状态说明：" class="headerlink" title="状态说明："></a>状态说明：</h4><ul>
<li>LISTEN：侦听来自远方的TCP端口的连接请求</li>
<li>SYN-SENT：再发送连接请求后等待匹配的连接请求（如果有大量这样的状态包，检查是否中招了）</li>
<li>SYN-RECEIVED：再收到和发送一个连接请求后等待对方对连接请求的确认（如有大量此状态，估计被flood攻击了）</li>
<li>ESTABLISHED：代表一个打开的连接</li>
<li>FIN-WAIT-1：等待远程TCP连接中断请求，或先前的连接中断请求的确认</li>
<li>FIN-WAIT-2：从远程TCP等待连接中断请求</li>
<li>CLOSE-WAIT：等待从本地用户发来的连接中断请求</li>
<li>CLOSING：等待远程TCP对连接中断的确认</li>
<li>LAST-ACK：等待原来的发向远程TCP的连接中断请求的确认（不是什么好东西，此项出现，检查是否被攻击）</li>
<li>TIME-WAIT：等待足够的时间以确保远程TCP接收到连接中断请求的确认<br>CLOSED：没有任何连接状态</li>
</ul>
<h3 id="实例2：列出所有端口"><a href="#实例2：列出所有端口" class="headerlink" title="实例2：列出所有端口"></a>实例2：列出所有端口</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -a</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -a</span></div><div class="line">Active Internet connections (servers and established)</div><div class="line">Proto Recv-Q Send-Q Local Address               Foreign Address             State      </div><div class="line">tcp        0      0 localhost:smux              *:*                         LISTEN      </div><div class="line">tcp        0      0 *:svn                       *:*                         LISTEN      </div><div class="line">tcp        0      0 *:ssh                       *:*                         LISTEN      </div><div class="line">tcp        0    284 192.168.120.204:ssh         10.2.0.68:62420             ESTABLISHED </div><div class="line">udp        0      0 localhost:syslog            *:*                                     </div><div class="line">udp        0      0 *:snmp                      *:*                                     </div><div class="line">Active UNIX domain sockets (servers and established)</div><div class="line">Proto RefCnt Flags       Type       State         I-Node Path</div><div class="line">unix  2      [ ACC ]     STREAM     LISTENING     708833 /tmp/ssh-yKnDB15725/agent.15725</div><div class="line">unix  2      [ ACC ]     STREAM     LISTENING     7296   /var/run/audispd_events</div><div class="line">unix  2      [ ]         DGRAM                    1491   @/org/kernel/udev/udevd</div><div class="line">unix  4      [ ]         DGRAM                    7337   /dev/<span class="built_in">log</span></div><div class="line">unix  2      [ ]         DGRAM                    708823 </div><div class="line">unix  2      [ ]         DGRAM                    7539   </div><div class="line">unix  3      [ ]         STREAM     CONNECTED     7287   </div><div class="line">unix  3      [ ]         STREAM     CONNECTED     7286   </div><div class="line">[root@localhost ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong><br>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;显示一个所有的有效连接信息列表，包括已建立的连接（ESTABLISHED），也包括监听连接请（LISTENING）的那些连接。</p>
<h3 id="实例3：显示当前UDP连接状况"><a href="#实例3：显示当前UDP连接状况" class="headerlink" title="实例3：显示当前UDP连接状况"></a>实例3：显示当前UDP连接状况</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -nu</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">[root@andy ~]<span class="comment"># netstat -nu</span></div><div class="line">Active Internet connections (w/o servers)</div><div class="line">Proto Recv-Q Send-Q Local Address               Foreign Address             State      </div><div class="line">udp        0      0 ::ffff:192.168.12:53392     ::ffff:192.168.9.120:10000  ESTABLISHED </div><div class="line">udp        0      0 ::ffff:192.168.12:56723     ::ffff:192.168.9.120:10000  ESTABLISHED </div><div class="line">udp        0      0 ::ffff:192.168.12:56480     ::ffff:192.168.9.120:10000  ESTABLISHED </div><div class="line">udp        0      0 ::ffff:192.168.12:58154     ::ffff:192.168.9.120:10000  ESTABLISHED </div><div class="line">udp        0      0 ::ffff:192.168.12:44227     ::ffff:192.168.9.120:10000  ESTABLISHED </div><div class="line">udp        0      0 ::ffff:192.168.12:36954     ::ffff:192.168.9.120:10000  ESTABLISHED </div><div class="line">udp        0      0 ::ffff:192.168.12:53984     ::ffff:192.168.9.120:10000  ESTABLISHED </div><div class="line">udp        0      0 ::ffff:192.168.12:57703     ::ffff:192.168.9.120:10000  ESTABLISHED </div><div class="line">udp        0      0 ::ffff:192.168.12:53613     ::ffff:192.168.9.120:10000  ESTABLISHED </div><div class="line">[root@andy ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例4：显示UDP端口号的使用情况"><a href="#实例4：显示UDP端口号的使用情况" class="headerlink" title="实例4：显示UDP端口号的使用情况"></a>实例4：显示UDP端口号的使用情况</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -apu</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div></pre></td><td class="code"><pre><div class="line">[root@andy ~]<span class="comment"># netstat -apu</span></div><div class="line">Active Internet connections (servers and established)</div><div class="line">Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   </div><div class="line">udp        0      0 *:57604                     *:*                                     28094/java          </div><div class="line">udp        0      0 *:40583                     *:*                                     21220/java          </div><div class="line">udp        0      0 *:45451                     *:*                                     14583/java          </div><div class="line">udp        0      0 ::ffff:192.168.12:53392     ::ffff:192.168.9.120:ndmp   ESTABLISHED 19327/java          </div><div class="line">udp        0      0 *:52370                     *:*                                     15841/java          </div><div class="line">udp        0      0 ::ffff:192.168.12:56723     ::ffff:192.168.9.120:ndmp   ESTABLISHED 15841/java          </div><div class="line">udp        0      0 *:44182                     *:*                                     31757/java          </div><div class="line">udp        0      0 *:48155                     *:*                                     5476/java           </div><div class="line">udp        0      0 *:59808                     *:*                                     17333/java          </div><div class="line">udp        0      0 ::ffff:192.168.12:56480     ::ffff:192.168.9.120:ndmp   ESTABLISHED 28094/java          </div><div class="line">udp        0      0 ::ffff:192.168.12:58154     ::ffff:192.168.9.120:ndmp   ESTABLISHED 15429/java          </div><div class="line">udp        0      0 *:36780                     *:*                                     10091/java          </div><div class="line">udp        0      0 *:36795                     *:*                                     24594/java          </div><div class="line">udp        0      0 *:41922                     *:*                                     20506/java          </div><div class="line">udp        0      0 ::ffff:192.168.12:44227     ::ffff:192.168.9.120:ndmp   ESTABLISHED 17333/java          </div><div class="line">udp        0      0 *:34258                     *:*                                     8866/java           </div><div class="line">udp        0      0 *:55508                     *:*                                     11667/java          </div><div class="line">udp        0      0 *:36055                     *:*                                     12425/java          </div><div class="line">udp        0      0 ::ffff:192.168.12:36954     ::ffff:192.168.9.120:ndmp   ESTABLISHED 16532/java          </div><div class="line">udp        0      0 ::ffff:192.168.12:53984     ::ffff:192.168.9.120:ndmp   ESTABLISHED 20506/java          </div><div class="line">udp        0      0 ::ffff:192.168.12:57703     ::ffff:192.168.9.120:ndmp   ESTABLISHED 31757/java          </div><div class="line">udp        0      0 ::ffff:192.168.12:53613     ::ffff:192.168.9.120:ndmp   ESTABLISHED 3199/java           </div><div class="line">udp        0      0 *:56309                     *:*                                     15429/java          </div><div class="line">udp        0      0 *:54007                     *:*                                     16532/java          </div><div class="line">udp        0      0 *:39544                     *:*                                     3199/java           </div><div class="line">udp        0      0 *:43900                     *:*                                     19327/java          </div><div class="line">[root@andy ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例5：显示网卡列表"><a href="#实例5：显示网卡列表" class="headerlink" title="实例5：显示网卡列表"></a>实例5：显示网卡列表</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -i</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[root@andy ~]<span class="comment"># netstat -i</span></div><div class="line">Kernel Interface table</div><div class="line">Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg</div><div class="line">eth0       1500   0 151818887      0      0      0 198928403      0      0      0 BMRU</div><div class="line">lo        16436   0   107235      0      0      0   107235      0      0      0 LRU</div><div class="line">[root@andy ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例6：显示组播组的关系"><a href="#实例6：显示组播组的关系" class="headerlink" title="实例6：显示组播组的关系"></a>实例6：显示组播组的关系</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -g</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">[root@andy ~]# netstat -g</div><div class="line">IPv6/IPv4 Group Memberships</div><div class="line">Interface       RefCnt Group</div><div class="line">--------------- ------ ---------------------</div><div class="line">lo              1      all-systems.mcast.net</div><div class="line">eth0            1      all-systems.mcast.net</div><div class="line">lo              1      ff02::1</div><div class="line">eth0            1      ff02::1:ffff:9b0c</div><div class="line">eth0            1      ff02::1</div><div class="line">[root@andy ~]#</div></pre></td></tr></table></figure>
<h3 id="实例7：显示网络统计信息"><a href="#实例7：显示网络统计信息" class="headerlink" title="实例7：显示网络统计信息"></a>实例7：显示网络统计信息</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -s</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -s</span></div><div class="line">Ip:</div><div class="line">    530999 total packets received</div><div class="line">    0 forwarded</div><div class="line">    0 incoming packets discarded</div><div class="line">    530999 incoming packets delivered</div><div class="line">    8258 requests sent out</div><div class="line">    1 dropped because of missing route</div><div class="line">Icmp:</div><div class="line">    90 ICMP messages received</div><div class="line">    0 input ICMP message failed.</div><div class="line">    ICMP input histogram:</div><div class="line">        destination unreachable: 17</div><div class="line">        <span class="built_in">echo</span> requests: 1</div><div class="line">        <span class="built_in">echo</span> replies: 72</div><div class="line">    106 ICMP messages sent</div><div class="line">    0 ICMP messages failed</div><div class="line">    ICMP output histogram:</div><div class="line">        destination unreachable: 8</div><div class="line">        <span class="built_in">echo</span> request: 97</div><div class="line">        <span class="built_in">echo</span> replies: 1</div><div class="line">IcmpMsg:</div><div class="line">        InType0: 72</div><div class="line">        InType3: 17</div><div class="line">        InType8: 1</div><div class="line">        OutType0: 1</div><div class="line">        OutType3: 8</div><div class="line">        OutType8: 97</div><div class="line">Tcp:</div><div class="line">    8 active connections openings</div><div class="line">    15 passive connection openings</div><div class="line">    8 failed connection attempts</div><div class="line">    3 connection resets received</div><div class="line">    1 connections established</div><div class="line">    3132 segments received</div><div class="line">    2617 segments send out</div><div class="line">    53 segments retransmited</div><div class="line">    0 bad segments received.</div><div class="line">    252 resets sent</div><div class="line">Udp:</div><div class="line">    0 packets received</div><div class="line">    0 packets to unknown port received.</div><div class="line">    0 packet receive errors</div><div class="line">    5482 packets sent</div><div class="line">TcpExt:</div><div class="line">    1 invalid SYN cookies received</div><div class="line">    1 TCP sockets finished time <span class="built_in">wait</span> <span class="keyword">in</span> fast timer</div><div class="line">    57 delayed acks sent</div><div class="line">    Quick ack mode was activated 50 <span class="built_in">times</span></div><div class="line">    60 packets directly queued to recvmsg prequeue.</div><div class="line">    68 packets directly received from backlog</div><div class="line">    4399 packets directly received from prequeue</div><div class="line">    520 packets header predicted</div><div class="line">    51 packets header predicted and directly queued to user</div><div class="line">    1194 acknowledgments not containing data received</div><div class="line">    21 predicted acknowledgments</div><div class="line">    0 TCP data loss events</div><div class="line">    1 timeouts after reno fast retransmit</div><div class="line">    9 retransmits <span class="keyword">in</span> slow start</div><div class="line">    42 other TCP timeouts</div><div class="line">    3 connections aborted due to timeout</div><div class="line">IpExt:</div><div class="line">    InBcastPkts: 527777</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;按照各个协议分别显示其统计数据。如果我们的应用程序（如Web浏览器）运行速度比较慢，或者不能显示Web页之类的数据，那么我们就可以用本选项来查看一下所显示的信息。我们需要仔细查看统计数据的各行，找到出错的关键字，进而确定问题所在。</p>
<h3 id="实例8：显示监听的套接口"><a href="#实例8：显示监听的套接口" class="headerlink" title="实例8：显示监听的套接口"></a>实例8：显示监听的套接口</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -l</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -l</span></div><div class="line">Active Internet connections (only servers)</div><div class="line">Proto Recv-Q Send-Q Local Address               Foreign Address             State      </div><div class="line">tcp        0      0 localhost:smux              *:*                         LISTEN      </div><div class="line">tcp        0      0 *:svn                       *:*                         LISTEN      </div><div class="line">tcp        0      0 *:ssh                       *:*                         LISTEN      </div><div class="line">udp        0      0 localhost:syslog            *:*                                     </div><div class="line">udp        0      0 *:snmp                      *:*                                     </div><div class="line">Active UNIX domain sockets (only servers)</div><div class="line">Proto RefCnt Flags       Type       State         I-Node Path</div><div class="line">unix  2      [ ACC ]     STREAM     LISTENING     708833 /tmp/ssh-yKnDB15725/agent.15725</div><div class="line">unix  2      [ ACC ]     STREAM     LISTENING     7296   /var/run/audispd_events</div><div class="line">[root@localhost ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例9：显示所有已建立的有效连接"><a href="#实例9：显示所有已建立的有效连接" class="headerlink" title="实例9：显示所有已建立的有效连接"></a>实例9：显示所有已建立的有效连接</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -n</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -n</span></div><div class="line">Active Internet connections (w/o servers)</div><div class="line">Proto Recv-Q Send-Q Local Address               Foreign Address             State      </div><div class="line">tcp        0    268 192.168.120.204:22          10.2.0.68:62420             ESTABLISHED </div><div class="line">Active UNIX domain sockets (w/o servers)</div><div class="line">Proto RefCnt Flags       Type       State         I-Node Path</div><div class="line">unix  2      [ ]         DGRAM                    1491   @/org/kernel/udev/udevd</div><div class="line">unix  4      [ ]         DGRAM                    7337   /dev/<span class="built_in">log</span></div><div class="line">unix  2      [ ]         DGRAM                    708823 </div><div class="line">unix  2      [ ]         DGRAM                    7539   </div><div class="line">unix  3      [ ]         STREAM     CONNECTED     7287   </div><div class="line">unix  3      [ ]         STREAM     CONNECTED     7286   </div><div class="line">[root@localhost ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例10：显示关于以太网的统计数据"><a href="#实例10：显示关于以太网的统计数据" class="headerlink" title="实例10：显示关于以太网的统计数据"></a>实例10：显示关于以太网的统计数据</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -e</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -e</span></div><div class="line">Active Internet connections (w/o servers)</div><div class="line">Proto Recv-Q Send-Q Local Address               Foreign Address             State       User       Inode     </div><div class="line">tcp        0    248 192.168.120.204:ssh         10.2.0.68:62420             ESTABLISHED root       708795     </div><div class="line">Active UNIX domain sockets (w/o servers)</div><div class="line">Proto RefCnt Flags       Type       State         I-Node Path</div><div class="line">unix  2      [ ]         DGRAM                    1491   @/org/kernel/udev/udevd</div><div class="line">unix  4      [ ]         DGRAM                    7337   /dev/<span class="built_in">log</span></div><div class="line">unix  2      [ ]         DGRAM                    708823 </div><div class="line">unix  2      [ ]         DGRAM                    7539   </div><div class="line">unix  3      [ ]         STREAM     CONNECTED     7287   </div><div class="line">unix  3      [ ]         STREAM     CONNECTED     7286   </div><div class="line">[root@localhost ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;用于显示关于以太网的统计数据。它列出的项目包括传送的数据报的总字节数、错误数、删除数、数据报的数量和广播的数量。这些统计数据既有发送的数据报数量，也有接收的数据报数量。这个选项可以用来统计一些基本的网络流量）</p>
<h3 id="实例11：显示关于路由表的信息"><a href="#实例11：显示关于路由表的信息" class="headerlink" title="实例11：显示关于路由表的信息"></a>实例11：显示关于路由表的信息</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -r</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -r</span></div><div class="line">Kernel IP routing table</div><div class="line">Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface</div><div class="line">192.168.120.0   *               255.255.255.0   U         0 0          0 eth0</div><div class="line">192.168.0.0     192.168.120.1   255.255.0.0     UG        0 0          0 eth0</div><div class="line">10.0.0.0        192.168.120.1   255.0.0.0       UG        0 0          0 eth0</div><div class="line">default         192.168.120.240 0.0.0.0         UG        0 0          0 eth0</div><div class="line">[root@localhost ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例12：列出所有-tcp-端口"><a href="#实例12：列出所有-tcp-端口" class="headerlink" title="实例12：列出所有 tcp 端口"></a>实例12：列出所有 tcp 端口</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -at</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -at</span></div><div class="line">Active Internet connections (servers and established)</div><div class="line">Proto Recv-Q Send-Q Local Address               Foreign Address             State      </div><div class="line">tcp        0      0 localhost:smux              *:*                         LISTEN      </div><div class="line">tcp        0      0 *:svn                       *:*                         LISTEN      </div><div class="line">tcp        0      0 *:ssh                       *:*                         LISTEN      </div><div class="line">tcp        0    284 192.168.120.204:ssh         10.2.0.68:62420             ESTABLISHED </div><div class="line">[root@localhost ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例13：统计机器中网络连接各个状态个数"><a href="#实例13：统计机器中网络连接各个状态个数" class="headerlink" title="实例13：统计机器中网络连接各个状态个数"></a>实例13：统计机器中网络连接各个状态个数</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -a | awk <span class="string">'/^tcp/ &#123;++S[$NF]&#125; END &#123;for(a in S) print a, S[a]&#125;'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -a | awk '/^tcp/ &#123;++S[$NF]&#125; END &#123;for(a in S) print a, S[a]&#125;'</span></div><div class="line">ESTABLISHED 1</div><div class="line">LISTEN 3</div><div class="line">[root@localhost ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例14：把状态全都取出来后使用uniq-c统计后再进行排序"><a href="#实例14：把状态全都取出来后使用uniq-c统计后再进行排序" class="headerlink" title="实例14：把状态全都取出来后使用uniq -c统计后再进行排序"></a>实例14：把状态全都取出来后使用uniq -c统计后再进行排序</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -nat |awk <span class="string">'&#123;print $6&#125;'</span>|sort|uniq -c</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">[root@andy ~]<span class="comment"># netstat -nat |awk '&#123;print $6&#125;'|sort|uniq -c</span></div><div class="line">     14 CLOSE_WAIT</div><div class="line">      1 established)</div><div class="line">    578 ESTABLISHED</div><div class="line">      1 Foreign</div><div class="line">     43 LISTEN</div><div class="line">      5 TIME_WAIT</div><div class="line">[root@andy ~]<span class="comment"># netstat -nat |awk '&#123;print $6&#125;'|sort|uniq -c|sort -rn</span></div><div class="line">    576 ESTABLISHED</div><div class="line">     43 LISTEN</div><div class="line">     14 CLOSE_WAIT</div><div class="line">      5 TIME_WAIT</div><div class="line">      1 Foreign</div><div class="line">      1 established)</div><div class="line">[root@andy ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例15：查看连接某服务端口最多的的IP地址"><a href="#实例15：查看连接某服务端口最多的的IP地址" class="headerlink" title="实例15：查看连接某服务端口最多的的IP地址"></a>实例15：查看连接某服务端口最多的的IP地址</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -nat | grep <span class="string">"192.168.120.20:16067"</span> |awk <span class="string">'&#123;print $5&#125;'</span>|awk -F: <span class="string">'&#123;print $4&#125;'</span>|sort|uniq -c|sort -nr|head -20</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line">[root@andy ~]<span class="comment"># netstat -nat | grep "192.168.120.20:16067" |awk '&#123;print $5&#125;'|awk -F: '&#123;print $4&#125;'|sort|uniq -c|sort -nr|head -20</span></div><div class="line">      8 10.2.1.68</div><div class="line">      7 192.168.119.13</div><div class="line">      6 192.168.119.201</div><div class="line">      6 192.168.119.20</div><div class="line">      6 192.168.119.10</div><div class="line">      4 10.2.1.199</div><div class="line">      3 10.2.1.207</div><div class="line">      2 192.168.120.20</div><div class="line">      2 192.168.120.15</div><div class="line">      2 192.168.119.197</div><div class="line">      2 192.168.119.11</div><div class="line">      2 10.2.1.206</div><div class="line">      2 10.2.1.203</div><div class="line">      2 10.2.1.189</div><div class="line">      2 10.2.1.173</div><div class="line">      1 192.168.120.18</div><div class="line">      1 192.168.119.19</div><div class="line">      1 10.2.2.227</div><div class="line">      1 10.2.2.138</div><div class="line">      1 10.2.1.208</div><div class="line">[root@andy ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例16：找出程序运行的端口"><a href="#实例16：找出程序运行的端口" class="headerlink" title="实例16：找出程序运行的端口"></a>实例16：找出程序运行的端口</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -ap | grep ssh</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">[root@andy ~]<span class="comment"># netstat -ap | grep ssh</span></div><div class="line">tcp        0      0 *:ssh                       *:*                         LISTEN      2570/sshd           </div><div class="line">tcp        0      0 ::ffff:192.168.120.206:ssh  ::ffff:10.2.1.205:54508     ESTABLISHED 13883/14            </div><div class="line">tcp        0      0 ::ffff:192.168.120.206:ssh  ::ffff:10.2.0.68:62886      ESTABLISHED 20900/6             </div><div class="line">tcp        0      0 ::ffff:192.168.120.206:ssh  ::ffff:10.2.2.131:52730     ESTABLISHED 20285/sshd: root@no </div><div class="line">unix  2      [ ACC ]     STREAM     LISTENING     194494461 20900/6             /tmp/ssh-cXIJj20900/agent.20900</div><div class="line">unix  3      [ ]         STREAM     CONNECTED     194307443 20285/sshd: root@no </div><div class="line">unix  3      [ ]         STREAM     CONNECTED     194307441 20285/sshd: root@no </div><div class="line">[root@andy ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<h3 id="实例17：在-netstat-输出中显示-PID-和进程名称"><a href="#实例17：在-netstat-输出中显示-PID-和进程名称" class="headerlink" title="实例17：在 netstat 输出中显示 PID 和进程名称"></a>实例17：在 netstat 输出中显示 PID 和进程名称</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -pt</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -pt</span></div><div class="line">Active Internet connections (w/o servers)</div><div class="line">Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   </div><div class="line">tcp        0    248 192.168.120.204:ssh         10.2.0.68:62420             ESTABLISHED 15725/0             </div><div class="line">[root@localhost ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;netstat -p 可以与其它开关一起使用，就可以添加 “PID/进程名称” 到 netstat 输出中，这样 debugging 的时候可以很方便的发现特定端口运行的程序。</p>
<h3 id="实例18：找出运行在指定端口的进程"><a href="#实例18：找出运行在指定端口的进程" class="headerlink" title="实例18：找出运行在指定端口的进程"></a>实例18：找出运行在指定端口的进程</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>命令</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">netstat -anpt | grep <span class="string">':16064'</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>输出</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line">[root@andy ~]<span class="comment"># netstat -anpt | grep ':16064'</span></div><div class="line">tcp        0      0 :::16064                    :::*                        LISTEN      24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:192.168.119.201:6462 ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:192.168.119.20:26341 ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:192.168.119.20:32208 ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:192.168.119.20:32207 ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:51303      ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:51302      ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:50020      ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:50019      ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:56155      ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:50681      ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:50680      ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:52136      ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:56989      ESTABLISHED 24594/java          </div><div class="line">tcp        0      0 ::ffff:192.168.120.20:16064 ::ffff:10.2.1.68:56988      ESTABLISHED 24594/java          </div><div class="line">[root@andy ~]<span class="comment">#</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong>说明</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;运行在端口16064的进程id为24596，再通过ps命令就可以找到具体的应用程序了。</p>

	

	
		<span class="different-posts"><a href="/2017/10/12/2. Linux 命令/58. Linux 命令- netstat/" onclick="window.history.go(-1); return false;">⬅️ Go back </a></span>

	

</article>

	</main>

	<footer class="footer">
	<div class="footer-content">
		
	      <div class="footer__element">
	<p>Hi there, <br />welcome to my Blog glad you found it. Have a look around, will you?</p>
</div>

	    
	      <div class="footer__element">
	<h5>Check out</h5>
	<ul class="footer-links">
		<li class="footer-links__link"><a href="/archives">Archive</a></li>
		
		  <li class="footer-links__link"><a href="/atom.xml">RSS</a></li>
	    
		<li class="footer-links__link"><a href="/about">about page</a></li>
		<li class="footer-links__link"><a href="/tags">Tags</a></li>
		<li class="footer-links__link"><a href="/categories">Categories</a></li>
	</ul>
</div>

	    

		<div class="footer-credit">
			<span>© 2017 失落的乐章 | Powered by <a href="https://hexo.io/">Hexo</a> | Theme <a href="https://github.com/HoverBaum/meilidu-hexo">MeiliDu</a></span>
		</div>

	</div>


</footer>



</body>

</html>
